package cn.xjzn.framework_Core;

/**
 * Created by zll on 2019/11/10.
 * ui枚举
 */
public enum UiServer {

    /**
     * 控件枚举类型
     */
    SIMPLESTATICCONTROL("简单的静态控件","1",0),
    DICTSELECTCONTROL("数据字典下拉控件","1",1),
    ENUMSELECTCONTROL("枚举下拉控件","1",2),
    BUSINESSELECTCONTROL("枚举下拉控件","1",3),
    CUSTOMSELECTCONTROL("客户自定义下拉控件","1",4),
    NODATASOURCESELECTCONTROL("无数据源下拉控件","1",5),

    /**
     * 固定类型的控件类型
     */
    STRINGSTATICCONTROL("字符串文本框","2",0),
    INTEGERSTATICCONTROL("整数文本框","2",1),
    REALNUMBERSTATICCONTROL("实数文本框","2",2),
    DATESTATICCONTROL("日期选择","2",3),
    POSITIVEREALNUMBERSTATICCONTROL("正实数文本框","2",4),
    EMAILSTATICCONTROL("电子邮件文本框","2",5),
    WEBSITESTATICCONTROL("网址文本框","2",6),
    POSITIVESTATICCONTROL("正整数文本框","2",7),
    CALCULATIONSTATICCONTROL("计算文本框","2",8),
    SINGLEELECTIONSTATICCONTROL("单选框","2",9),
    CHECKSTATICCONTROL("复选框","2",10),
    MULTILINETEXTSTATICCONTROL("多行文本框","2",11),
    QUOTESTATICCONTROL("引用文本框","2",15),
    IMGUPLOADSTATICCONTROL("图片上传及预览控件","2",38),
    SPECIALDATESTATICCONTROL("特殊日期控件","2",1001),

    /**
     * 数据类型
     */
    STRINGDATATYPE("字符类型","3",0),
    UNITPRICEDATATYPE("单价类型","3",1),
    TOTALSUMDATATYPE("总金额类型","3",2),
    NUMBERDATATYPE("数量类型","3",3),
    PERCENTAGEDATATYPE("百分比类型","3",4),
    ABOUTMONEYDATATYPE("与金额相关的数据类型","3",5),


    /**
     * ui事件
     */
    CLICKEVENTTYPE("单击事件","4",0),
    BLUREVENTTYPE("焦点离开事件","4",1),
    DBCLICKEVENTTYPE("双击事件","4",2),
    CHANGEEVENTTYPE("值改变事件","4",3),
    FOCUSEVENTTYPE("焦点集中事件","4",4),
    MOUSEOVEREVENTTYPE("光标经过事件","4",5),
    MOUSEOUTEVENTTYPE("光标离开事件","4",6),
    CONTEXTMENUEVENTTYPE("右键上下文事件","4",7),
    RESIZEEVENTTYPE("尺寸改变事件","4",8),
    LOADEVENTTYPE("加载完成事件","4",9),
    COPYEVENTTYPE("复制事件","4",10),
    CUTEVENTTYPE("剪切事件","4",11),
    PASTEEVENTTYPE("粘贴事件","4",12),
    SCROLLEVENTTYPE("滚动事件","4",13),
    TRIGGERCLICKEVENTTYPE("单个引用图标单击事件","4",14),
    SELECTEVENTTYPE("下拉框选择一项事件","4",15),
    BEFORESHOWEVENTTYPE("下拉框显示之前事件","4",16),
    VALIDEVENTTYPE("输入生效事件","4",17),
    AFTEREDITEVENTTYPE("编辑完成事件","4",101),
    BEFOREEDITEVENTTYPE("开始编辑之前事件","4",102),

    /**
     * ui事件处理器
     */
    ALERTHANDLETYPE("警告","5",10),
    CONFIRMHANDLETYPE("确认","5",11),
    CLOSEHANDLETYPE("关闭窗口","5",12),
    OPENHANDLETYPE("打开新窗口","5",13),
    FOCUSCONTROLHANDLETYPE("焦点聚集","5",99),
    FORMAUTOREFERENCEHANDLETYPE("主表自动引用","5",100),
    GRIDAUTOREFERENCEHANDLETYPE("grid表自动引用","5",101),

    UNKNOWN("未知","",-1);


    private String name;
    private String type;
    private int value;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    UiServer(String name, String type, int value) {
        this.name = name;
        this.type = type;
        this.value = value;
    }

    public static UiServer getEnumByValue(int value, String type) {
        UiServer[] ModuleServes = UiServer.values();
        for (int i = 0; i < ModuleServes.length; i++) {
            if (ModuleServes[i].getValue() == value && ModuleServes[i].getType().equals(type)) {
                return ModuleServes[i];
            }
        }
        return UiServer.UNKNOWN;
    }

}
